#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f3f3f3f3f;
int a[100007];
int b[100007];
bool cmp(int a,int b){
	return a > b;
}
void solve(){
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a + 1,a + n + 1);
	sort(b + 1,b + n + 1,cmp);
	ll ans = -INF;
	for(int i = 0;i <= 5;i++){
		int j = 5 - i;
		ll sum = 1;
		for(int k = 1;k <= i;k++){
			sum *= a[k];
		}
		for(int k = 1;k <= j;k++){
			sum *= b[k];
		}
		ans = max(ans,sum);
	}
	cout << ans << "\n";
}
int main(){
	int t;
	cin >> t;
	while(t--) solve();
}